import http from '/@/utils/http';

/**
 * 公共api接口集合
 * @method uploadFileApi 文件/图片上传接口
 * @method dictionaryList 数据字典列表
 * @method dictionaryOPList 运营端数据字典列表
 * @method addDictionary 添加数据字典
 * @method editDictionary 编辑数据字典
 * @method deleteDictionary 删除数据字典
 * @method getDirectorListApi 获取负责人下拉 负责人类型；1.保养负责人 2.验证负责人 3.点检负责人 4.维修负责人 5.仓库负责人
 * @method getDirectorListByType 获取负责人下拉框列表（可模糊查询姓名）
 * @method bindFileUrlApi 绑定私有文件/图片路径
 * @method fileZipListApi 分页查询压缩包任务
 * @method deleteZipApi 删除单个压缩任务
 * @method deleteAllZipApi 删除所有压缩任务
 * @method updateParentIdAndSortApi 修改所属父级以及排序
 * @method updateDictionaryIdAndSortApi 修改数据字典所属父级以及排序
 * @method bindFileUrlByFileNameApi 绑定文件路径，并指定下载文件名
 * @method getAuthorizedUrlApi 企业微信获取企业授权跳转地址
 */

export const uploadFileApi = async (params: any) => {
    return await http.postUpload(`/user/upload/uploadFile`, params)
}

export const dictionaryList = async (params: any) => {
    return await http.post(`/system/mobile/sysDataDictionary/dictionaryList`, params)
}

export const dictionaryOPList = async (params: any) => {
    return await http.post(`/system/mobile/sysDataDictionary/getManagerDictionaryList`, params)
}

export const addDictionary = async (params: any) => {
    return await http.post(`/system/mobile/sysDataDictionary/addDictionary`, params)
}

export const editDictionary = async (params: any) => {
    return await http.put(`/system/mobile/sysDataDictionary/editDictionary`, params)
}

export const deleteDictionary = async (params: any) => {
    return await http.delete(`/system/mobile/sysDataDictionary/deleteDictionary/${params}`)
}

export const getDirectorListApi = async (params: any) => {
    return await http.get(`/user/mobile/userInfo/getDirectorList/${params}`)
}

export const getDirectorListByType = async (params: any) => {
    return await http.post(`/user/mobile/userInfo/getDirectorListByType`, params)
}

export const bindFileUrlApi = async (fileUrl: any) => {
    return await http.get(`/user/upload/bindFileUrl?fileUrl=${fileUrl}`)
}

export const fileZipListApi = async (pn: any, ps: any, userId: any) => {
    return await http.get(`/device/files/zip/list/${pn}/${ps}/${userId}`)
}

export const deleteZipApi = async (zipTaskId: any) => {
    return await http.delete(`/device/files/zip/delete/${zipTaskId}`)
}

export const deleteAllZipApi = async (userId: any) => {
    return await http.delete(`/device/files/zip/delete/all/${userId}`)
}

export const updateParentIdAndSortApi = async (params: any) => {
    return await http.put(`/user/mobile/sysDeptInfo/updateParentIdAndSort`, params)
}

export const updateDictionaryIdAndSortApi = async (params: any) => {
    return await http.put(`/system/mobile/sysDataDictionary/updateParentIdAndSort`, params)
}

export const getButtonListByRoleApi = async (params: any) => {
    return await http.post(`/user/mobile/sysMenuInfo/getButtonListByRole`, params)
}

export const bindFileUrlByFileNameApi = async (fileUrl: any, fileName: any) => {
    return await http.get(`/user/upload/bindFileUrlByFileName?fileUrl=${fileUrl}&fileName=${fileName}`)
}

export const getAuthorizedUrlApi = async () => {
    return await http.get(`/user/thirdApi/getAuthorizedUrl`)
}